package com.office.supplies.controller;

import org.dromara.x.file.storage.core.FileInfo;
import org.dromara.x.file.storage.core.FileStorageService;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/file/local-plus")
//@RestController
@CrossOrigin("http://localhost:8080")
public class ViewFileController {

    private final FileStorageService fileStorageService;

    public ViewFileController(FileStorageService fileStorageService) {
        this.fileStorageService = fileStorageService;
    }

    @GetMapping("/{url}")
    // 给浏览器返回图片
    public FileInfo view(@PathVariable String url) {
        return fileStorageService.getFileInfoByUrl(url);
    }


}